from typing import List

class Solution:
    def permuteUnique(self, nums: List[int]) -> List[List[int]]:
        def dfs(nums,size,path,res):
            if len(path)==size:
                res.append(path[:])
                return
            for i in range(size):
                path.append(nums[i])
                dfs(nums,size,path,res)
                path.pop()
        size = len(nums)

        path = list()
        res = list()
        dfs(nums,size,path,res)
        return res

if __name__ == '__main__':
    nums = [1,2,3]
    solution = Solution()
    val = solution.permuteUnique(nums)
    print(val)